package jp.gr.jted.test;

import java.util.ArrayList;

import jp.gr.jted.bean.Language;
import jp.gr.jted.bean.Talk;
import jp.gr.jted.util.TedUtil;

public class Ted {

	public static void main(String args[]){
		TedUtil tedUtil = new TedUtil();
		try {
			ArrayList<Talk> pageList = tedUtil.getTalkList(1);
			System.out.println(tedUtil.getPageNum());
//			for(Talk talk : pageList){
			for(int idx=0;idx<1;idx++){
				Talk talk = pageList.get(idx);
				System.out.println(talk.getTitle());
				System.out.println(talk.getUrl());
				System.out.println(talk.getThumbnail());
				Talk talkDetail = tedUtil.getTalkDetail(talk.getUrl());
				System.out.println(talkDetail.getId());
				ArrayList<Language> languageList = talkDetail.getLanguageList();
				for(Language language : languageList){
					System.out.print("\t");
					System.out.print(language.getLcid());
					System.out.print(":");
					System.out.println(language.getLanguageName());
				}
				System.out.println(talkDetail.getFirstSubtitle());
				System.out.println(talkDetail.getSecoundSubtitle());
				System.out.println("");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
